#pragma once
#include <iostream>

class Rational
{
	int x, y;

	void swap(Rational &b) {
		std::swap(x, b.x);
		std::swap(y, b.y);
	}

public:
	Rational(int);
	Rational(int, int);
	Rational(Rational const &);
	Rational operator-();
	Rational & operator+=(const Rational &);
	Rational & operator-=(const Rational &);
	Rational & operator*=(const Rational &);
	Rational & operator/=(const Rational &);
	Rational & operator=(const Rational &);
	Rational & operator++();
	Rational operator++(int);
	Rational & operator--();
	Rational operator--(int);
	operator double() const;

	friend bool const operator<(const Rational &, const Rational &);

	void out();	
	int reduce(void);

};

bool const operator<(const Rational &, const Rational &);
bool const operator>(const Rational &, const Rational &);
bool const operator==(const Rational &, const Rational &);
bool const operator!=(const Rational &, const Rational &);
bool const operator<=(const Rational &, const Rational &);
bool const operator>=(const Rational &, const Rational &);
Rational operator+(const Rational &, const Rational &);
Rational operator-(const Rational &, const Rational &);
Rational operator/(const Rational &, const Rational &);
Rational operator*(const Rational &, const Rational &);